package com.yjq.blog.user.controller;

import com.yjq.blog.annotation.IgnoreResponse;
import com.yjq.blog.user.entity.User;
import com.yjq.blog.user.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/{id}")
    public User getUserById(@PathVariable("id") Integer id) {
        User user = userService.getUserById(id);
        System.out.println(user);
        return user;
    }

    @IgnoreResponse
    @GetMapping("/list")
    public Map<Integer, User> getUserMapByIdList(@RequestParam("idList")List<Integer> idList) {
        return userService.getUserMapByIdList(idList);
    }

}
